import pyzstd


# 文件压缩
def compress_file(input_file: str, output_file: str, level: int = 3):
    with open(input_file, "rb") as f_in:
        data = f_in.read()
    compressed_data = pyzstd.compress(data, level_or_option=level)
    with open(output_file, "wb") as f_out:
        f_out.write(compressed_data)


# 文件解压
def decompress_file(input_file: str):
    with open(input_file, "rb") as f_in:
        compressed_data = f_in.read()
    decompressed_data = pyzstd.decompress(compressed_data)

    return decompressed_data
